<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/30
 * Time: 9:24
 */

namespace app\Flagship\Controller;


use app\Model\AdminModel;
use app\Model\FlagshipModel;
use think\Controller;

//登陆
class Login extends Controller
{
    /*
     * 登陆页
     */
    public function login()
    {
        if (session('?Flagship')){
            $this->redirect('Flagship/index');
        }
        return view();
    }
    
    /*
     * 判断登陆账户
     */
    public function loginJudge()
    {

        $postData = input('post.');
        $where = ['mobile'=>$postData['mobile'],
                  'password'=>encryption($postData['password'])];
        $getAdmin = FlagshipModel::where($where)->find();
        setDatabaseDef($getAdmin,'账号或密码错误');
//        if ($getAdmin->forbidden==0){
//           return retJson('',201,'该账号已被禁用，请联系管理员');
//        }
        session('Flagship',$getAdmin);
        return setDatabase($getAdmin,'登陆');
    }
    /*
     * 实验
     */
    public function sy()
    {
        return view();
    }
    
    /*
     * 注册页
     */
    public function register()
    {
        return view();
    }
    /*
     * 退出登陆
     */
    public function outlogin()
    {
        session('Flagship',null);
        $this->redirect('login');
    }
    //订单数据
//    public function xinxi(){
//
//    }

}